home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / AppKiller 1.2.1 / src / aevent.c next >
Encoding:
C/C++ Source or Header  |  1996-01-04  |  2.0 KB  |  83 lines  |  [TEXT/CWIE]

  1. /*
  2. ** aevent.c
  3. **
  4. ** This module contains all the code for the program to handle the
  5. ** required Apple Events.  Of the four types, only two really
  6. ** pertain to the program (open and quit) with quit
  7. ** being the only used.
  8. */
  9.  
  10. #ifndef THINK_C
  11.  /* #include all the macintosh headers... */
  12. #include <AppleEvents.h>
  13. #include <Desk.h>
  14. #include <Dialogs.h>
  15. #include <Events.h>
  16. #include <Fonts.h>
  17. #include <GestaltEqu.h>
  18. #include <Menus.h>
  19. #include <OSEvents.h>
  20. #include <QuickDraw.h>
  21. #include <ToolUtils.h>
  22. #include <Types.h>
  23. #include <Windows.h>
  24. #else
  25.  #include "ak_headers"
  26. #endif
  27. #include "aevent.h"
  28. #include "appkiller.h"
  29.  
  30. static pascal OSErr QuitHandler(AppleEvent*, AppleEvent*, long);
  31. static pascal OSErr OappHandler(AppleEvent*, AppleEvent*, long);
  32. static pascal OSErr OdocHandler(AppleEvent*, AppleEvent*, long);
  33. static pascal OSErr PrintHandler(AppleEvent*, AppleEvent*, long);
  34.  
  35.  
  36. void InitAEs(void)
  37. {
  38.     OSErr err;
  39.     /* install event handlers for the core apple events. */
  40.     err = AEInstallEventHandler( kCoreEventClass, kAEQuitApplication,
  41.                 (AEEventHandlerUPP)QuitHandler, 0, FALSE);
  42.     err = AEInstallEventHandler( kCoreEventClass, kAEOpenApplication,
  43.                 (AEEventHandlerUPP)OappHandler, 0, FALSE);
  44.     err = AEInstallEventHandler( kCoreEventClass, kAEOpenDocuments,
  45.                 (AEEventHandlerUPP)OdocHandler, 0, FALSE);
  46.     err = AEInstallEventHandler( kCoreEventClass, kAEPrintDocuments,
  47.                 (AEEventHandlerUPP)PrintHandler, 0, FALSE);
  48. } /* InitAEs() */
  49.  
  50.  
  51. void DoAppleEvent(EventRecord *theEvent)
  52. {
  53.     OSErr err;
  54.     err = AEProcessAppleEvent(theEvent);
  55. } /* DoAppleEvent() */
  56.  
  57.  
  58. /*===================================  HANDLERS FOLLOW... */
  59.  
  60.  
  61. static pascal OSErr QuitHandler(AppleEvent *theAppleEvent,
  62.                 AppleEvent *reply, long handlerRefcon)
  63. {
  64.     Cleanup();
  65. } /* QuitHandler() */
  66.  
  67.  
  68. static pascal OSErr OappHandler(AppleEvent *theAppleEvent,
  69.                 AppleEvent *reply, long handlerRefcon)
  70. {
  71. }
  72.  
  73. static pascal OSErr OdocHandler(AppleEvent *theAppleEvent,
  74.                 AppleEvent *reply, long handlerRefcon)
  75. {
  76. }
  77.  
  78. static pascal OSErr PrintHandler(AppleEvent *theAppleEvent,
  79.                 AppleEvent *reply, long handlerRefcon)
  80. {
  81. }
  82.  
  83.